﻿using System.Collections.Generic;
using Interfaces;
using System.Linq;

namespace Models
{
    public class GenericItem : IGenericItem
    {
        #region Fields

        private List<Item> _item;

        #endregion

        #region Properties

        public int Id { get; private set; }
        public string Name { get; private set; }
        public decimal Price { get; private set; }
        public bool Available { get; private set; }

        #endregion

        #region Creation

        public GenericItem(int inputId, string inputName, decimal inputPrice, bool inputAvailable)
        {
            Id = inputId;
            Name = inputName;
            Price = inputPrice;
            Available = inputAvailable;

            _item = null;
        }

        #endregion

        #region Public Methods

        public List<IItem> GetItems()
        {
            return _item.Select(e => (IItem) e).ToList();   
        }

        public void AddItems(List<Item> inputItems)
        {
            _item = inputItems;
        }

        public string GetName()
        {
            return Name;
        }

        #endregion

    }
}
